/**
 * @Description:
 * @Author 卞鹏飞 <228443632@qq.com>
 * @create 07/08/24 11:08 PM
 */

export type TEnv = 'localDev' | 'localSit' | 'localUat' | 'dev' | 'sit' | 'uat' | 'prd'

export type TProxyEntity = Partial<{
  prefix: string
  rule: {
    target: string
    ws: string
    changeOrigin: boolean
    pathRewrite: any
  }
}>

export type TEnvEntity = Partial<{
  baseUrl: string // 后台网关地址
  socketIp: string
  dictUrl: string // 字典
  apps: Partial<{ name: string; entry: string; topic: string }>[]
}>

export type TServerUnion = 'mock' | 'cf' | 'common' | 'userCenter' | 'cfDisposalUser' | 'wkBpm'

interface IAppsItem {
  base: string
  entry: string
  title?: string
}

export type TProfile = Partial<{
  baseUrl: string
  IS_PRO: boolean
  apps: IAppsItem[]
  APP_MODE: TEnv // 当前应用环境 sit dev uat local
  envMap: { [K in TEnv]: TEnvEntity } // 环境映射
  proxy: { [K in TServerUnion]: TProxyEntity }
  whiteApis: string[]
  microAppUrlMap: Record<string, any>
  /**
   * 需要权限的路径
   */
  authComponentPaths: string[] | RegExp[]

  [K: string]: any
}>
